<template>
  <div class="login-container">
    <div class="formBox">
      <div class="title">XX后台管理系统</div>
      <a-form
        :model="formData"
        name="basic"
        :label-col="{ span: 7 }"
        :wrapper-col="{ span: 19 }"
        autocomplete="off"
      >
        <a-form-item
          label="Username"
          name="username"
          :rules="[{ required: true, message: 'Please input your username!' }]"
        >
          <a-input v-model:value="formData.username" />
        </a-form-item>

        <a-form-item
          label="Password"
          name="password"
          :rules="[{ required: true, message: 'Please input your password!' }]"
        >
          <a-input-password v-model:value="formData.password" />
        </a-form-item>

        <a-form-item :wrapper-col="{ offset: 10, span: 14 }">
          <a-button type="primary" @click="loginFn">Submit</a-button>
        </a-form-item>
      </a-form>
    </div>
  </div>
</template>
<script setup lang="ts">
import { loginReq } from "@/api/user";

const formData = ref<any>({
  username: "",
  password: "",
});

const loginFn = async () => {
  try {
    const res = await loginReq(formData.value);
    console.log(res);
  } catch (error) {
    console.log(error);
  }
};
</script>
<style lang="scss" scoped>
.login-container {
  width: 100%;
  height: 100vh;
  background: linear-gradient(
    to top right,
    rgb(187, 187, 250),
    rgb(250, 214, 221)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  .formBox {
    width: 20vw;
    border: 1px solid #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0px 0px 10px 5px #8a8a8a;
    .title {
      font-size: 22px;
      text-align: center;
      margin-bottom: 20px;
    }
  }
}
</style>
